package com.starlink.model.util;

import com.starlink.model.dtomapper.SearchRecordDtoMapper;
import com.starlink.model.domain.SearchRecordDO;
import com.starlink.model.vo.SearchRecordVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class SearchRecordConvert {

    public static List<SearchRecordVO> buildSearchRecordVoList(List<SearchRecordDO> searchRecordDOList) {
        if (CollectionUtils.isEmpty(searchRecordDOList)) {
            return Lists.newArrayList();
        }
        List<SearchRecordVO> searchRecordVOList = new ArrayList<>();
        for (SearchRecordDO searchRecordDO : searchRecordDOList) {
            searchRecordVOList.add(SearchRecordDtoMapper.INSTANCE.do2VO(searchRecordDO));
        }

        return searchRecordVOList;
    }
}
